<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class FocusUser extends Model
{
    use HasFactory;

    protected $table = "focus_user";

    public function getFocusList($userId)
    {
        $user = new User();
        $data = array();
        $res = self::where('user_id', $userId)->get();
        if($res) $data = $res->toArray();
        foreach($data as $k => $v)
        {
            $userInfo = $user->getUserInfoById($v['focus_user_id']);

            $data[$k]['userInfo'] = $userInfo;
        }

        return $data;
    }
}
